﻿var fadein;
var fadeout;

function pageLoad() {
    // Set the image so it can accept a click,
    // and tell it to call "popupImage"
    var slide = $find('SSBehaviorID');
    slide.add_slideChanging(animateSlides);

    var ae = $find("ae");
    var be = ae.get_OnLoadBehavior();
    var an = be.get_animation();
    fadein = an.get_animations()[1];
    fadeout = an.get_animations()[0];

    fadein.set_duration(0.5);
    fadeout.set_duration(0.5);

    var imgx = $find('img1');
    $addHandler($get("<%=img1.ClientID%>"), "click", popupImage);
}

function animateSlides(sender, args) {
    fadein.play();
    window.setTimeout("fadeout.play()", 1000);

}

function popupImage() {
    // This is where you set how wide you want your popup window
    var awidth = 800;
    // This is where you set how high you want your popup window
    var aheight = 600;
    // This calculates the middle of the screen Horizontally
    var leftVal = (screen.width / 2) - (awidth / 2);
    // This calculates the middle of the screen Vertically
    var topVal = (screen.height / 2) - (aheight / 2);

    // This is where you set it to show scrollbars.
    var showScrollbars = 0; // Hide Scrollbars
    //var showScrollbars = 1; // Show Scrollbars

    // This is where you set it to be resizable or not.
    var isResizable = 0; //Not resizable
    //var isResizable = 1; //Is resizable

    // This is where you set it to show Toolbars.
    var showToolbar = 0; // Hide Toolbar
    //var showToolbar = 1; // Show Toolbar

    // This is where you set it to show Status or not.
    var showStatus = 0; // Hide Status
    //var showStatus = 1; // Show Status

    // This is where you tell the window to popup
    window.open($get("<%=img1.ClientID%>").src
                    , ''
                    , 'scrollbars = ' + showScrollbars +
                     ', height = ' + aheight +
                     ', width = ' + awidth +
                     ', resizable = ' + isResizable +
                     ', toolbar = ' + showToolbar +
                     ', status = ' + showStatus +
                     ', left = ' + leftVal +
                     ', top = ' + topVal);
}